<template>
    <embed :src="reccourselData" type="application/pdf"
        width="100%" height="740px" />
</template>
<script>
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from "element-plus";
import axios from '../../api/index';
import { useRoute, useRouter } from 'vue-router';

export default {
    setup() {
        let route = useRoute();
        let router = useRouter();
        let itemId = route.params.productId;
        let token = localStorage.getItem('token');
        let longtoken = localStorage.getItem('longtoken');
        let reccourselData = ref();
        console.log(itemId);

        onMounted(async () => {
            axios.get('/course/findById', {
                    params: {
                        courseId: itemId
                    },
                    headers: {
                        token: token,
                        longtoken: longtoken
                    }
                }).then(response => {
                    if (response.code === 200) {
                        console.log(response.data);
                        reccourselData.value = response.data.goodAddress;
                        
                    }
                })
        });
        return{
            reccourselData,
            itemId,
            route,
            router,
            token,
            longtoken,
        }

    }
}
</script>
<style>

</style>